<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <link rel="shortcut icon" href="./jsp/standard/theme/davco/img/logo_mini.ico" type="image/x-icon" />
  <title>西卡德高欢迎您</title>
  <style type="text/css">
    html,
    body {
      margin: 0px;
      height: 100%;
    }
  </style>
  <script>
    // 获取指定名称的cookie
    function getCookie(name) {
      var strcookie = document.cookie;//获取cookie字符串
      var arrcookie = strcookie.split("; ");//分割
      //遍历匹配
      for (var i = 0; i < arrcookie.length; i++) {
        var arr = arrcookie[i].split("=");
        if (arr[0] == name) {
          return arr[1];
        }
      }
      return "";
    }

    function loadURL() {
      console.log('初始化加载中...');
      var isGoon = true;
      try {
        var isStaffChat = getCookie("isStaffChat");
        console.log("检测到当前浏览器是否打开或登录坐席端网聊：", isStaffChat);
        if (isStaffChat == "true") {
          isGoon = confirm('检测到当前浏览器已经打开或登录坐席端网聊，打开访客端会导致坐席端会话异常！确认打开访客？');
          console.log("确认结果：", isGoon);
        }
      } catch (ex) {
        console.warn('检测到当前浏览器已经打开或登录坐席端网聊异常', ex);
      }

      if (isGoon) {
        var url = document.location.toString();//获取url地址
        var interURL = url.replace("webChat.htm", "interfacePools.do") + '&isShow=true';//获取问号后所有的字符串
        console.log(url);
        console.log(interURL);
        document.getElementById("reportFrame").src = interURL;
      } else {
        if (navigator.userAgent.indexOf("Firefox") != -1 || navigator.userAgent.indexOf("Chrome") != -1) {
          open(location, '_self').close();
          window.location.href = "404.html";
          window.close();
        } else {
          window.opener = null;
          window.open("", "_self");
          window.close();
          open(location, '_self').close();
        }
      }

      console.log('初始化加载结束');
    }
  </script>
</head>

<body onload="loadURL();">
  <div style="width: 100%; height: 100%; display: flex; flex-flow: column; position: relative;">
    <div style="flex: 1 1 0%; position: relative; height: 0px;"></div>
    <div style="height: 100%; display: flex; position: relative; min-height: 100%;">
      <div style="flex: 1 1 0%; position: relative; width: 0px;"></div>
      <div
        style="width: 100%; min-width: 100%; min-height: 100%; position: relative;box-shadow: 0 0 24px 0 rgb(15 66 76 / 25%)">
        <iframe id="reportFrame"
          style="width: 100%; height: 100%; position: relative; display: block; border-width: 0px;" name="reportFrame"
          frameBorder=0 scrolling=no width="100%"></iframe>
      </div>
      <div style="flex: 1 1 0%; position: relative; width: 0px;"></div>
    </div>
    <div style="flex: 1 1 0%; position: relative; height: 0px;"></div>
  </div>
</body>

</html>